﻿<style type="text/css">
    .news-bottom ul li{display:-webkit-box;border-bottom: 1px solid #f2f2f2;clear: both;position: relative;}
    .news-bottom ul li a{display: block;display:-webkit-box;padding-top: 10px;padding-bottom: 10px;}
    .news-bottom ul li .news-pic{margin-left: 15px;margin-top:5px;}
    .news-bottom ul li .news-pic img{width: 50px;height: 50px;display: inline-block;}
    .news-cont{margin: 5px 0px 6px 15px;-webkit-box-flex: 1;}
    .news-cont h2{font-size: 18px;display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;font-weight: 700;margin-right: 120px;}
    .news-cont p{display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;font-size: 15px;color: #999;margin-top: 5px;}
    .news-time{position: absolute;top:20px;right: 20px;color: #ccc}
</style>
<div class="news-bottom">
    <ul>
        <li v-for="data in bag.datas">
            <a v-on:click="detail(data.id,data.title)">
                <div class="news-pic">
                    <img :src="data.icon">
                </div>
                <div class="news-cont">
                    <h2 v-text="data.title">-</h2>
                    <p v-text="data.content">-</p>
                </div>
                <span class="news-time" v-text="data.date">-</span>
            </a>
        </li>
    </ul>
</div>
<div style="text-align:center;margin-top:0.5em;" v-if="bag.dataend == false">
    <a v-on:click="more" v-text="morename" style="color:#888;">-</a>
</div>
<div style="text-align:center;margin-top:0.5em;" v-if="bag.dataend == true">
    <a style="color:#aaa;">已显示所有</a>
</div>
<div style="height:60px;"></div>
<script type="text/javascript">
    var pagedata = {
        request: {
            method: "VIEW_NOTICE_NEWLISTS",
            page: 0
        },
        screen: {
            header_display: true,
            header_title_name: "公告",
            header_exit_name: "返回",
            header_exit_click: function () {
                mview.url.gohome();
            },
            footer_display: true,
            footer_choose: "home"
        },
        data: {
            morename: "查看更多"
        },
        methods: {
            detail: function (id, title) {
                mview.view.load('/views/notice/newdetail.html', {
                    id: id,
                    title: title
                });
            },
            //加载更多
            more: function () {
                pagedata.request.page += 1;
                mview.socket.send({
                    data: {
                        method: "VIEW_NOTICE_NEWLISTS",
                        page: pagedata.request.page,
                        part: 1
                    },
                    success: function (json) {
                        if (json.Code == 0 && json.Data.datas.length > 0) {
                            for (var i in json.Data.datas) {
                                var data = json.Data.datas[i];
                                mview.vue.stage.$data.bag.dataend = json.Data.dataend;
                                mview.vue.stage.$data.bag.datas.push(data);
                            }
                        }
                    }
                });
            }
        }
    }
    mview.view.chlid.init(pagedata);
</script>